package com.guigu.www.tangyingmeng.controller;

import com.guigu.www.pojo.*;
import com.guigu.www.tangyingmeng.service.TymWrokService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/work")
public class TymWorkController {

    @Autowired
    private TymWrokService service;

    @PostMapping("/selworkall")
    public PageVo<Intervention> selworkall (@RequestBody Map<String,String> map) {
        PageVo<Intervention> pageVo = service.selworkall(map);
        return pageVo;
    }

    @PostMapping("/upwork")
    public Boolean selworkall (@RequestBody Intervention intervention) {
        Boolean falg = service.upwork(intervention);
        return falg;
    }

    @PostMapping("/seltemplateall")
    public List<InterventionTemplate> seltemplateall(){
        List<InterventionTemplate> list = service.seltemplateall();
        return list;
    }

    @PostMapping("/selfoodall")
    public List<FoodZong> selfoodall () {
        List<FoodZong> list = service.selfoodall();
        return list;
    }

    @PostMapping("/selkeepall")
    public List<KeepZong> selkeepall () {
        List<KeepZong> list = service.selkeepall();
        return list;
    }

    @PostMapping("/selwhoall")
    public List<TemplateWholesome> selwhoall () {
        List<TemplateWholesome> list = service.selwhoall();
        return list;
    }

    @GetMapping("/selworkone/{id}")
    public Intervention selworkone(@PathVariable("id") Integer id) {
        Intervention intervention = service.selworkone(id);
        return intervention;
    }

    @GetMapping("/delwork/{id}")
    public Boolean delwork(@PathVariable("id") Integer id) {
        Boolean delwork = service.delwork(id);
        return delwork;
    }

    @GetMapping("/statemethod/{id}")
    public Boolean statemethod(@PathVariable("id") Integer id){
        Boolean falg = service.statemethod(id);
        return falg;
    }

    @GetMapping("/stopmethod/{id}")
    public Boolean stopmethod(@PathVariable("id") Integer id){
        Boolean falg = service.stopmethod(id);
        return falg;
    }
}
